package com.rabbitmq.provider;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author luhui
 * @version 1.0
 * Email: luhui60@jd.com
 * date:2021/4/27 15:25
 * description：
 **/
@RestController
public class TestController {

    @Autowired
    private AmqpTemplate amqpTemplate;

    @GetMapping("/sendMessage")
    public void sendMessage(String msg){
        amqpTemplate.convertAndSend("fanout-exchange","",msg);
    }
}
